home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 4 / The 640 Meg Shareware Studio CD-ROM Volume IV (Data Express)(1994).ISO / clang / cuj0593.zip / 1105098A < prev    next >
Text File  |  1993-05-16  |  468b  |  25 lines

  1. /* copy2.c */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. main(int argc, char *argv[])
  7. {
  8.     char s[BUFSIZ];
  9.  
  10.     /* Open optional input file */
  11.     if (argc > 1)
  12.         if (freopen(argv[1],"r",stdin) == NULL)
  13.             return EXIT_FAILURE;
  14.  
  15.     /* Open optional output file */
  16.     if (argc > 2)
  17.         if (freopen(argv[2],"w",stdout) == NULL)
  18.             return EXIT_FAILURE;
  19.  
  20.     while (gets(s))
  21.         puts(s);
  22.     return EXIT_SUCCESS;
  23. }
  24.  
  25.